<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="java.util.Date"%>
<%@page import="com.djc8.entity.*"%>
<%@page import="com.djc8.dao.imp.*"%>
<%@page import="com.djc8.dao.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%
		boolean flag = false;//添加用户
		if (flag) {
			UserDAOImp di = new UserDAOImp();
			UserBean ub = new UserBean();
			for (int i = 0; i < 100; i++) {
				ub = new UserBean();
				ub.getUserSecretBean().setUserName("xwz" + i);
				ub.getUserSecretBean().setPwd("123");
				ub.getUserInfoBean().setUiEmail("user" + i + "@djc8.com");
				ub.getUserInfoBean().setUiHeadImg("user" + i + ".jpg");
				ub.getUserInfoBean().setUiNice("user" + i);
				ub.getUserInfoBean().setUiNote("今天天气不错啊！" + i);
				//ub.getUserInfoBean().setUsId(52);
				if (di.addUser(ub)) {
					out.print(ub.getUserSecretBean().getUserName()
							+ " 添加成功<br/>");
				} else {
					out.print(ub.getUserSecretBean().getUserName()
							+ " 添加失败<br/>");
				}
			}
		}
		flag = true;//书籍分类
		if (flag) {
			IBookClassifyDAO ibc = new BookClassifyDAOImp();
			for (int i = 1; i < 10; i++) {
				ibc.addClassifyName(new BookClassifyBean(0, "xwz" + i, -1));
			}
			for (int i = 1; i < 10; i++) {
				ibc.addClassifyName(new BookClassifyBean(0, "xwz1"+i, i));
			}

			ibc.addClassifyName(new BookClassifyBean(0, "xwz1", 1));
		}
		out.print("----------------------书籍分类添加成功-------------------------<br/>");
		flag = false;
		if (flag) {
			IBookDAO iba = new BookDAOImp();
			for (int i = 0; i < 100; i++) {
				BookBean bb = new BookBean();
				//书籍附表
				BookAddBean bab = new BookAddBean();
				bab.setBookReadNum(10);
				bab.setBookStoreUpNumber(20);
				bab.setBookTalkNum(30);
				bb.setBookAddBean(bab);
				//书籍信息表
				BookInfoBean bib = new BookInfoBean();
				bib.setBookClassifyId(1);
				bib.setBookName("小蚊子书籍" + i);
				bib.setBookDelete(false);

				bb.setBookInfoBean(bib);

				//书籍详情表
				BookDetialBean bdb = new BookDetialBean();
				bdb.setBookAuthor("小蚊子" + i);
				bdb.setBookISBN("123456789987654321");
				bdb.setBookName("小蚊子书籍" + i);
				bdb.setBookPage(20);
				bdb.setBookPric(20.00);
				bdb.setBookPub("福建出版社");
				bdb.setBookPubDate(new Date());
				bdb.setBookAddDate(new Date());

				bb.setBookDetialBean(bdb);
				//书籍详情附表
				BookDetialAddBean bdab = new BookDetialAddBean();
				bdab.setBookCatalogue("第一章：小蚊子，第二章：打蚊子" + i);
				bdab.setBookContent("讲述了一只蚊子的成长" + i);

				bb.setBookDetialAddBean(bdab);

				if (iba.addNewBook(bb))
					out.print(i + "添加书籍成功啦<br/>");
			}
		}
		out.print("---------------------------书籍添加成功---------------------------<br/>");
		flag = false;
		if (flag) {
			IBookReviewsDAO ird = new BookReviewsDAOImp();
			BookReviewsBean brb = new BookReviewsBean();
			for (int i = 1; i < 10; i++) {
				for (int k = 1; k < 10; k++) {
					brb.setBookReviewsSimpleBean(new BookReviewsSimpleBean(
							0, k, i, "这本书很独到！" + i, new Date(), false));

					brb.setBookReviewsDetialBean(new BookReviewsDetialBean(
							0, "我从这里学习到了很多东西"));
					if (ird.addBookReviews(brb)) {
						out.print("用户" + i + " 书籍" + k + "添加成功<br/>");
					}
				}

			}

		}
		out.print("---------------------------书评添加成功---------------------------");
	%>
</body>
</html>